Multiply two polynomials
Given two polynomials represented by two arrays, write a function that multiplies given two polynomials....
read more
Maximum and minimum of an array using minimum number of comparisons
Given an array of size N. The task is to find the maximum and the minimum element of the array using the minimum number of comparisons....
read more
Minimum window size containing atleast P primes in every window of given range
Given three integers X, Y and P, the task is to find the minimum window size K such that every window in the range [X, Y] of this size have atleast P prime numbers.Examples:...
read more
Puzzle | Find the overweight islander
There are 12 men on an island. 11 weigh exactly the same, but one of them is slightly lighter or heavier. There is a seesaw to determine who is the odd one out. Find out the minimum number of times the seesaw will be used....
read more
Largest Square in a Binary Matrix with at most K 1s for multiple Queries
Given a binary matrix M where each element of the matrix will be 0 or 1, the task is to find the largest square that can be formed with center (i, j) and contains most K 1’s....
read more
Smallest divisor of N closest to X
Given two positive integers N and X, the task is to find the smallest divisor of N which is closest to X....
read more
Divide a sorted array in K parts with sum of difference of max and min minimized in each part – Set 2
Given an ascending sorted array arr[] of size N and an integer K, the task is to partition the given array into K non-empty subarrays such that the sum of differences of the maximum and the minimum of each subarray is minimized....
read more
Change in Median of given array after deleting given elements
Given two arrays arr1[] and arr2[]. The array arr1[] is sorted. The task is to print the change in the median after removing each element from array arr2[] one by one....
read more
Advanced master theorem for divide and conquer recurrences
The Master Theorem is a tool used to solve recurrence relations that arise in the analysis of divide-and-conquer algorithms. The Master Theorem provides a systematic way of solving recurrence relations of the form:...
read more
Closest Pair of Points | O(nlogn) Implementation
We are given an array of n points in the plane, and the problem is to find out the closest pair of points in the array...
read more
Find a Fixed Point (Value equal to index) in a given array
Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is any Fixed Point present in array, else returns -1. Fixed Point in an array is an index i such that arr[i] is equal to i. Note that integers in array can be negative. Examples:...
read more
Find MEX of every subtree in given Tree
Given a Generic Tree consisting of N nodes numbered from 0 to N – 1 which is rooted at node 0 and an array val[] such that the value at each node is represented by val[i],  the task for each node is to find the value of MEX of its subtree....
read more